﻿using System.Collections.Generic;
using System.Linq;
using log4net;
using SmallBusinessKit.DataAccess.Interfaces;
using SmallBusinessKit.Interfaces;
using SmallBusinessKit.Models.Entities;

namespace SmallBusinessKit.Domains
{
    public class TestimonialDomain : ITestimonialDomain
    {
        #region Properties

        private static readonly ILog _log = LogManager.GetLogger(typeof(TestimonialDomain));

        private readonly ITestimonialRepository _testimonialRepository;

        #endregion

        #region Methods

        public TestimonialDomain(ITestimonialRepository testimonialRepository)
        {
            _testimonialRepository = testimonialRepository;
        }
        
        public IEnumerable<Testimonial> GetAllTestimonials()
        {
            var results = _testimonialRepository.GetMany(i => i.IsVisible).ToList();

            _log.DebugFormat("Retrieved {0} Testimonials", results.Count);

            return results;
        }

        #endregion
    }
}
